package testClasses.misc;

import java.util.ArrayList;
import java.util.HashMap;

public class ModifierMathTest {
	
	public HashMap<String, Double> variables = new HashMap<String, Double>();
	public HashMap<String, ArrayList<String>> appliedModifiers = new HashMap<String, ArrayList<String>>();
	
	
	
	public boolean applyModifier(String modifier) {
		//parse input string
		String[] pieces = modifier.split(" ");
		String mod = pieces[0] + " " + pieces[2];
		
		System.out.println("PIECES: " + pieces[0] + " " + pieces[1] + " " + pieces[2]);
		System.out.println("MOD: " + mod);
		
		Double var = variables.get(pieces[1]);
		System.out.println("VAR NAME: " + pieces[1] + " VAR VAL: " + var);
		
		Double apply = new Double(pieces[2]);		
		System.out.println("APPLIED VAR: " + apply);
		
		Double newVar = variables.get(pieces[1]) + apply;
		System.out.println("NEWVAR: " + newVar);

		return true;
	}	
	

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ModifierMathTest test = new ModifierMathTest();
		test.variables.put("test1", 3.4);
		test.variables.put("test2", -2.1);
		
		test.applyModifier("NanoMachines test1 -2");
		
	}

}
